package icu.sehnen.company.controller;



import icu.sehnen.company.entity.Company;
import icu.sehnen.company.service.ICompanyService;
import icu.sehnen.common.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author icu.sehnen
 * @since 2021-04-26
 */
@RestController
@RequestMapping("/company")
public class CompanyController {
    @Autowired
    ICompanyService companyService;

    @RequestMapping("/list")
    public CommonResult findAll(){
       List<Company> company=companyService.list();
        return  CommonResult.success(company.get(0));
    }
    @PostMapping("/update")
    public CommonResult updateImg(Company company){
        Boolean res= companyService.updateById(company);
        if(res){
            return  CommonResult.success();
        }
        return  CommonResult.failed();

    }

}
